package com.huishu.order.execl;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;

/**
 * @ClassName：StatusConverter
 * @Author: ljj
 * @Date: 2022/5/11 16:39
 */
public class StatusConverter implements Converter<Integer> {

    @Override
    public Class supportJavaTypeKey() {
        return Integer.class;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }

    // 1->待发货；2->已发货；3->已完成；4->已取消；5->已退款； 6 申请退款 7 申请退货退款 8 已退货退款 9 申请换货 10 已换货
    @Override
    public WriteCellData convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        if (value.equals(1)) {
            return new WriteCellData("待发货");
        } else if (value.equals(2)) {
            return new WriteCellData("已发货");
        } else if (value.equals(3)) {
            return new WriteCellData("已完成");
        } else if (value.equals(4)) {
            return new WriteCellData("已取消");
        } else if (value.equals(5)) {
            return new WriteCellData("已退款");
        } else if (value.equals(6)) {
            return new WriteCellData("申请退款");
        } else if (value.equals(7)) {
            return new WriteCellData("申请退货退款");
        } else if (value.equals(8)) {
            return new WriteCellData("已退货退款");
        } else if (value.equals(9)) {
            return new WriteCellData("申请换货");
        } else if (value.equals(10)) {
            return new WriteCellData("已换货");
        } else {
            return new WriteCellData("已关闭");
        }
    }
}
